<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            background-color: sandybrown;
        }
        #contant{
            width: 100%;
            /* align-content: center; */
            text-align: center;
            /* display: flex;
            justify-content: center; */
            margin-bottom: 100px;
        }
        #top{
            margin: auto;
        }
        #btound{
            margin: auto;
        }
    </style>
</head>
<body>
    <div id="contant">
        <table style="width: 400px;" id="top">
            <tr style="text-align: center;">
                <td colspan="2">
                    <span id="sp1"></span>
                </td>
                <!-- <td></td> -->
            </tr>
            <tr style="text-align:right">
                <td><span id="sp2" style="padding-right: 10px;"></span></td>
                <td style="width: 120px;text-align: left;"><span id="sp3"></span></td>
            </tr>
            <tr>
                <td colspan="2">
                    <span id="sp4"></span>
                </td>
                <!-- <td></td> -->
            </tr>
        </table>
        <p>-----------------------------------------------------------------------</p>
        <table style="width: 400px;" id="btound">
            <tr style="text-align: center;">
                <td colspan="2">
                    <span id="ssp1"></span>
                </td>
                <!-- <td></td> -->
            </tr>
            <tr style="text-align:right">
                <td><span id="ssp2" style="padding-right: 10px;"></span></td>
                <td style="width: 120px;text-align: left;"><span id="ssp3"></span></td>
            </tr>
            <tr>
                <td colspan="2">
                    <span id="ssp4"></span>
                </td>
                <!-- <td></td> -->
            </tr>
        </table>
        
    </div>
</body>
    <script>
        function a(){
            var ajax=new XMLHttpRequest();
            ajax.open('post','http://poetry.apiopen.top/poetryFull?count=2&page=2');
            ajax.send();
            ajax.onreadystatechange=function(){
                if(ajax.readyState==4 && ajax.status==200){ 
                    var obj=JSON.parse(ajax.responseText);
                    if(obj.code == 200 && obj.message=='成功!'){
                        document.getElementById('sp1').innerText=obj.result[0].title;
                        document.getElementById('sp2').innerText=obj.result[0].dynasty;
                        document.getElementById('sp3').innerText=obj.result[0].writer;
                        document.getElementById('sp4').innerText=obj.result[0].content;
                        console.log(obj.result);
                    }
                }
            }
        }

        function b(){
            var ajax=new XMLHttpRequest();
            ajax.open('post','http://poetry.apiopen.top/poetryFull?count=2&page=2');
            ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
            ajax.send();
            ajax.onreadystatechange=function(){
                if(ajax.readyState==4 && ajax.status==200){ 
                    var obj=JSON.parse(ajax.responseText);
                    if(obj.code == 200 && obj.message=='成功!'){
                        document.getElementById('ssp1').innerText=obj.result[1].title;
                        document.getElementById('ssp2').innerText=obj.result[1].dynasty;
                        document.getElementById('ssp3').innerText=obj.result[1].writer;
                        document.getElementById('ssp4').innerText=obj.result[1].content;
                        console.log(obj.result);
                    }
                }
            }
        }
        onload=function(){
            a();
            b();
        }

    </script>
</html>